package com.atguigu.cloud.apis;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.atguigu.cloud.entities.Pay;
import com.atguigu.cloud.entities.PayDTO;
import com.atguigu.cloud.resp.ResultData;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName PayFeignApi
 * @description: 通用api
 * @author: linkai
 * @create: 2024-11-03 15:29
 **/
//@FeignClient(value = "cloud-payment-service")
@FeignClient(value = "cloud-gateway")
public interface PayFeignApi {

    @PostMapping(value = "/pay/add")
    @Operation(summary = "新增",description = "新增支付流水方法")
    public ResultData addPay(@org.springframework.web.bind.annotation.RequestBody PayDTO payDTO);

    @DeleteMapping(value = "/pay/del/{id}")
    @Operation(summary = "删除",description = "删除支付流水方法")
    public  ResultData deletePay(@PathVariable("id") Integer id);
    @PutMapping(value = "/pay/update")
    @Operation(summary = "修改",description = "修改支付流水方法")
    public ResultData updatePay(@RequestBody PayDTO payDTO);
    @GetMapping(value = "/pay/get/{id}")
    @Operation(summary = "查询",description = "根据id查询支付流水方法")
    public ResultData getPayById(@PathVariable("id") Integer id);

    @GetMapping(value = "/pay/getPayList")
    @Operation(summary = "查询全部",description = "查询全部支付流水方法")
    public ResultData getPayList();

    /**
     * openfeign天然支持负载均衡演示
     * @return
     */
    @GetMapping(value = "/pay/get/info")
    public String getInfoByConsul();


    /***
     * Resilience4j CircuitBreaker 的例子
     **/
    @GetMapping(value = "/pay/circuit/{id}")
    public String myCircuit(@PathVariable("id") Integer id);
    /***
     * Resilience4j Bulkhead  的例子
     **/
    @GetMapping(value = "/pay/bulkhead/{id}")
    public String myBulkhead(@PathVariable("id") Integer id);
    /***
     * Resilience4j Ratelimit  的例子
     **/
    @GetMapping(value = "/pay/ratelimit/{id}")
    public String myRatelimit(@PathVariable("id") Integer id);
    /***
     * Micrometer 链路追踪 的例子
     **/
    @GetMapping(value = "/pay/micrometer/{id}")
    public String myMicrometer(@PathVariable("id") Integer id);

    /**
     * Gateway 网关
     **/
    @GetMapping(value = "/pay/gateway/get/{id}")
    public ResultData getById(@PathVariable("id") Integer id);

    @GetMapping(value = "/pay/gateway/info")
    public ResultData<String> getGatewayInfo();

}


